home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 January / macformat-020.iso / Shareware City / Developers / MoreFiles 1.2.1 / FSpCompat.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-20  |  9.8 KB  |  305 lines  |  [TEXT/KAHL]

  1. /*
  2. **    Apple Macintosh Developer Technical Support
  3. **
  4. **    FSSpec compatibility functions.
  5. **
  6. **    by Jim Luther, Apple Developer Technical Support
  7. **
  8. **    File:        FSpCompat.h
  9. **
  10. **    Copyright © 1992-1994 Apple Computer, Inc.
  11. **    All rights reserved.
  12. **
  13. **    You may incorporate this sample code into your applications without
  14. **    restriction, though the sample code has been provided "AS IS" and the
  15. **    responsibility for its operation is 100% yours.  However, what you are
  16. **    not permitted to do is to redistribute the source as "DSC Sample Code"
  17. **    after having made changes. If you're going to re-distribute the source,
  18. **    we require that you make it clear in the source that the code was
  19. **    descended from Apple Sample Code, but that you've made changes.
  20. */
  21.  
  22. #ifndef __FSPCOMPAT__
  23. #define __FSPCOMPAT__
  24.  
  25. #ifndef __CONDITIONALMACROS__
  26. #include <ConditionalMacros.h>
  27. #endif
  28.  
  29. #ifndef __TYPES__
  30. #include <Types.h>
  31. #endif
  32.  
  33. #ifndef __LOWMEM__
  34. #include <LowMem.h>
  35. #endif
  36.  
  37. #ifndef __GESTALTEQU__
  38. #include <GestaltEqu.h>
  39. #endif
  40.  
  41. #ifndef __RESOURCES__
  42. #include <Resources.h>
  43. #endif
  44.  
  45. #ifndef __SCRIPT__
  46. #include <Script.h>
  47. #endif
  48.  
  49. /* The old interfaces needed this for the gestaltQuickTime selector */
  50. //#ifndef __MOVIES__
  51. //#include <Movies.h>
  52. //#endif
  53.  
  54. #ifndef __MOREFILESEXTRAS__
  55. #include "MoreFilesExtras.h"
  56. #endif
  57.  
  58. /*****************************************************************************/
  59.  
  60. pascal    OSErr    FSMakeFSSpecCompat(short vRefNum,
  61.                                    long dirID,
  62.                                    ConstStr255Param fileName,
  63.                                    FSSpecPtr spec);
  64. /*    ¶ Initialize a FSSpec record.
  65.     The FSMakeFSSpecCompat function fills in the fields of an FSSpec record.
  66.     If the file system can't create the FSSpec, then the compatibility code
  67.     creates a FSSpec that is exactly like an FSSpec except that spec.name
  68.     for a file may not have the same capitalization as the file's catalog
  69.     entry on the disk volume. That is because fileName is parsed to get the
  70.     name instead of getting the name back from the file system. This works
  71.     fine with System 6 where FSMakeSpec isn't available.
  72.     
  73.     vRefNum        input:    Volume specification.
  74.     dirID        input:    Directory ID.
  75.     fileName    input:    Pointer to object name, or nil when dirID specifies
  76.                         a directory that's the object.
  77.     spec        output:    A file system specification to be filled in by
  78.                         FSMakeFSSpecCompat.
  79. */
  80.  
  81. /*****************************************************************************/
  82.  
  83. pascal    OSErr    FSpOpenDFCompat(const FSSpec *spec,
  84.                                 char permission,
  85.                                 short *refNum);
  86. /*    ¶ Open a file's data fork.
  87.     The FSpOpenDFCompat function opens the data fork of the file specified
  88.     by spec.
  89.     Differences from FSpOpenDF: If FSpOpenDF isn't available,
  90.     FSpOpenDFCompat uses PHBOpen because System 6 doesn't support PBHOpenDF.
  91.     This means FSpOpenDFCompat could accidentally open a driver if the
  92.     spec->name begins with a period.
  93.     
  94.     spec        input:    An FSSpec record specifying the file whose data
  95.                         fork is to be opened.
  96.     permission    input:    A constant indicating the desired file access
  97.                         permissions.
  98.     refNum        output:    A reference number of an access path to the file's
  99.                         data fork.
  100.  
  101.     __________
  102.     
  103.     See also:    FSpOpenAware
  104. */
  105.  
  106. /*****************************************************************************/
  107.  
  108. pascal    OSErr    FSpOpenRFCompat(const FSSpec *spec,
  109.                                 char permission,
  110.                                 short *refNum);
  111. /*    ¶ Open a file's resource fork.
  112.     The FSpOpenRFCompat function opens the resource fork of the file
  113.     specified by spec.
  114.     
  115.     spec        input:    An FSSpec record specifying the file whose resource
  116.                         fork is to be opened.
  117.     permission    input:    A constant indicating the desired file access
  118.                         permissions.
  119.     refNum        output:    A reference number of an access path to the file's
  120.                         resource fork.
  121.  
  122.     __________
  123.     
  124.     See also:    FSpOpenRFAware
  125. */
  126.  
  127.  
  128. /*****************************************************************************/
  129.  
  130. pascal    OSErr    FSpCreateCompat(const FSSpec *spec,
  131.                                 OSType creator,
  132.                                 OSType fileType,
  133.                                 ScriptCode scriptTag);
  134. /*    ¶ Create a new file.
  135.     The FSpCreateCompat function creates a new file with the specified
  136.     type, creator, and script code.
  137.     Differences from FSpCreate: FSpCreateCompat correctly sets the
  138.     fdScript in the file's FXInfo record to scriptTag if the problem
  139.     isn't fixed in the File Manager code.
  140.     
  141.     spec        input:    An FSSpec record specifying the file to create.
  142.     creator        input:    The creator of the new file.
  143.     fileType    input    The file type of the new file.
  144.     scriptCode    input:    The code of the script system in which the file
  145.                         name is to be displayed.
  146. */
  147.  
  148. /*****************************************************************************/
  149.  
  150. pascal    OSErr    FSpDirCreateCompat(const FSSpec *spec,
  151.                                    ScriptCode scriptTag,
  152.                                    long *createdDirID);
  153. /*    ¶ Create a new directory.
  154.     The FSpDirCreateCompat function creates a new directory and returns the
  155.     directory ID of the newDirectory.
  156.     
  157.     spec            input:    An FSSpec record specifying the directory to
  158.                             create.
  159.     scriptCode        input:    The code of the script system in which the
  160.                             directory name is to be displayed.
  161.     createdDirID    output:    The directory ID of the directory that was
  162.                             created.
  163. */
  164.  
  165. /*****************************************************************************/
  166.  
  167. pascal    OSErr    FSpDeleteCompat(const FSSpec *spec);
  168. /*    ¶ Delete a file or directory.
  169.     The FSpDeleteCompat function deletes a file or directory.
  170.     
  171.     spec            input:    An FSSpec record specifying the file or 
  172.                             directory to delete.
  173. */
  174.  
  175. /*****************************************************************************/
  176.  
  177. pascal    OSErr    FSpGetFInfoCompat(const FSSpec *spec,
  178.                                   FInfo *fndrInfo);
  179. /*    ¶ Get the finder information for a file.
  180.     The FSpGetFInfoCompat function gets the finder information for a file.
  181.  
  182.     spec        input:    An FSSpec record specifying the file.
  183.     fndrInfo    output:    If the object is a file, then its FInfo.
  184.  
  185.     __________
  186.     
  187.     Also see:    FSpGetDInfo
  188. */
  189.  
  190. /*****************************************************************************/
  191.  
  192. pascal    OSErr    FSpSetFInfoCompat(const FSSpec *spec,
  193.                                   const FInfo *fndrInfo);
  194. /*    ¶ Set the finder information for a file.
  195.     The FSpSetFInfoCompat function sets the finder information for a file.
  196.  
  197.     spec        input:    An FSSpec record specifying the file.
  198.     fndrInfo    input:    The FInfo.
  199.  
  200.     __________
  201.     
  202.     Also see:    FSpSetDInfo
  203. */
  204.  
  205. /*****************************************************************************/
  206.  
  207. pascal    OSErr    FSpSetFLockCompat(const FSSpec *spec);
  208. /*    ¶ Lock a file.
  209.     The FSpSetFLockCompat function locks a file.
  210.  
  211.     spec        input:    An FSSpec record specifying the file.
  212. */
  213.  
  214. /*****************************************************************************/
  215.  
  216. pascal    OSErr    FSpRstFLockCompat(const FSSpec *spec);
  217. /*    ¶ Unlock a file.
  218.     The FSpRstFLockCompat function unlocks a file.
  219.  
  220.     spec        input:    An FSSpec record specifying the file.
  221. */
  222.  
  223. /*****************************************************************************/
  224.  
  225. pascal    OSErr    FSpRenameCompat(const FSSpec *spec,
  226.                                 ConstStr255Param newName);
  227. /*    ¶ Rename a file or directory.
  228.     The FSpRenameCompat function renames a file or directory.
  229.  
  230.     spec        input:    An FSSpec record specifying the file.
  231.     newName        input:    The new name of the file or directory.
  232. */
  233.  
  234. /*****************************************************************************/
  235.  
  236. pascal    OSErr    FSpCatMoveCompat(const FSSpec *source,
  237.                                  const FSSpec *dest);
  238. /*    ¶ Move a file or directory to a different location on on the same volume.
  239.     The FSpCatMoveCompat function moves a file or directory to a different
  240.     location on on the same volume.
  241.  
  242.     source        input:    An FSSpec record specifying the file or directory.
  243.     dest        input:    An FSSpec record specifying the name and location
  244.                         of the directory into which the source file or
  245.                         directory is to be moved.
  246. */
  247.  
  248. /*****************************************************************************/
  249.  
  250. pascal    OSErr    FSpExchangeFilesCompat(const FSSpec *source,
  251.                                        const FSSpec *dest);
  252. /*    ¶ Exchange the data stored in two files on the same volume.
  253.     The FSpExchangeFilesCompat function swaps the data in two files by
  254.     changing the information in the volume's catalog and, if the files
  255.     are open, in the file control blocks.
  256.     Differences from FSpExchangeFiles: Correctly exchanges files on volumes
  257.     that don't support PBExchangeFiles. FSpExchangeFiles attempts to support
  258.     volumes that don't support PBExchangeFiles, but in System 7, 7.0.1, 7.1,
  259.     and 7 Pro, the compatibility code just doesn't work on volumes that
  260.     don't support PBExchangeFiles (even though you may get a noErr result).
  261.     System Update 3.0 and System 7.5 and later have the problems in
  262.     FSpExchangeFiles corrected.
  263. */
  264.  
  265. /*****************************************************************************/
  266.  
  267. pascal    short    FSpOpenResFileCompat(const FSSpec *spec,
  268.                                      SignedByte permission);
  269. /*    ¶ Open a file's resource file.
  270.     The FSpOpenResFileCompat function opens the resource file specified
  271.     by spec.
  272.     
  273.     spec            input:    An FSSpec record specifying the file whose
  274.                             resource file is to be opened.
  275.     permission        input:    A constant indicating the desired file access
  276.                             permissions.
  277.     function result    output:    A resource file reference number, or if there's
  278.                             an error -1.
  279. */
  280.  
  281. /*****************************************************************************/
  282.  
  283. pascal    void    FSpCreateResFileCompat(const FSSpec *spec,
  284.                                        OSType creator,
  285.                                        OSType fileType,
  286.                                        ScriptCode scriptTag);
  287. /*    ¶ Create a resource file.
  288.     The FSpCreateResFileCompat function creates a new resource file with
  289.     the specified type, creator, and script code.
  290.     Differences from FSpCreateResFile: FSpCreateResFileCompat correctly
  291.     sets the fdScript in the file's FXInfo record to scriptTag if the
  292.     problem isn't fixed in the File Manager code.
  293.     
  294.     spec        input:    An FSSpec record specifying the resource file to create.
  295.     creator        input:    The creator of the new file.
  296.     fileType    input    The file type of the new file.
  297.     scriptCode    input:    The code of the script system in which the file
  298.                         name is to be displayed.
  299. */
  300.  
  301. /*****************************************************************************/
  302.  
  303. #endif
  304.  
  305.